import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '岗位名称',
    align: "center",
    dataIndex: 'positionName'
  },
  // {
  //   title: '岗位级别',
  //   align: "center",
  //   dataIndex: 'positionLevel_dictText'
  // },
  {
    title: '岗位描述',
    align: "center",
    dataIndex: 'positionDesc',
  },
  // {
  //   title: '状态',
  //   align: "center",
  //   dataIndex: 'status',
  //   customRender:({text}) => {
  //      return  render.renderSwitch(text, [{text:'是',value:'Y'},{text:'否',value:'N'}]);
  //    },
  // },
  {
    title: '创建人',
    align: "center",
    dataIndex: 'createBy'
  },
  {
    title: '创建日期',
    align: "center",
    sorter: true,
    dataIndex: 'createTime'
  },
  {
    title: '更新人',
    align: "center",
    dataIndex: 'updateBy'
  },
  {
    title: '更新日期',
    align: "center",
    sorter: true,
    dataIndex: 'updateTime'
  },
];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "岗位名称",
    field: 'positionName',
    component: 'Input',
    //colProps: {span: 6},
  },
  {
    label: "岗位级别",
    field: 'positionLevel',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "position_level"
    },
    //colProps: {span: 6},
  },
  {
    label: "状态",
    field: 'status',
    component: 'JSwitch',
    componentProps:{
    },
    //colProps: {span: 6},
  },
  {
    label: "创建日期",
    field: 'createTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
    },
    //colProps: {span: 6},
  },
  {
    label: "更新日期",
    field: 'updateTime',
    component: 'DatePicker',
    componentProps: {
      showTime: true,
    },
    //colProps: {span: 6},
  },
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '岗位名称',
    field: 'positionName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入岗位名称!'},
             ];
    },
  },
  {
    label: '岗位级别',
    field: 'positionLevel',
    component: 'JDictSelectTag',
    componentProps:{
      dictCode: "position_level"
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入岗位级别!'},
             ];
    },
  },
  {
    label: '岗位描述',
    field: 'positionDesc',
    component: 'JEditor',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入岗位描述!'},
             ];
    },
  },
  {
    label: '状态',
    field: 'status',
    component: 'JSwitch',
    componentProps:{
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  positionName: {title: '岗位名称',order: 0,view: 'text', type: 'string',},
  positionLevel: {title: '岗位级别',order: 1,view: 'list', type: 'string',dictCode: 'position_level',},
  positionDesc: {title: '岗位描述',order: 2,view: 'umeditor', type: 'string',},
  status: {title: '状态',order: 3,view: 'switch', type: 'string',},
  createBy: {title: '创建人',order: 4,view: 'text', type: 'string',},
  createTime: {title: '创建日期',order: 5,view: 'datetime', type: 'string',},
  updateBy: {title: '更新人',order: 6,view: 'text', type: 'string',},
  updateTime: {title: '更新日期',order: 7,view: 'datetime', type: 'string',},
};
